package com.kgc.storeconsumer.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.kgc.basic.util.ResponseMsg;
import com.kgc.store.pojo.InStoreDetail;
import com.kgc.store.pojo.OutStoreDetail;
import com.kgc.storeconsumer.feign.InStoreDetailFeign;
import com.kgc.storeconsumer.feign.OutStoreDetailFeign;
import com.kgc.storeconsumer.feign.OutStoreFeign;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@CrossOrigin("*")
@RequestMapping("/outStoreDetail")
public class OutStoreDetailController {
    private Logger logger = LoggerFactory.getLogger(getClass());
    @Autowired
    private OutStoreDetailFeign outStoreDetailFeign;

    @RequestMapping("getOutStoreDetailList")
    @ResponseBody
    public ResponseMsg getOutStoreDetailList(String outStoreCode){
        logger.info("OutStoreDetailController getOutStoreDetailList outStoreCode:"+outStoreCode);
        ResponseMsg msg =outStoreDetailFeign.getOutStoreDetailList(outStoreCode);
        logger.debug("OutStoreDetailController getOutStoreDetailList inStoreCode:"+outStoreCode);
        return msg;
    }


    @RequestMapping("delOutStoreDetail")
    @ResponseBody
    public ResponseMsg delOutStoreDetail(Integer id){
        logger.info("OutStoreDetailController delOutStoreDetail id:"+id);
        ResponseMsg msg =outStoreDetailFeign.delOutStoreDetail(id);
        logger.debug("OutStoreDetailController delOutStoreDetail id:"+id);
        return msg;
    }

    @RequestMapping("addOutStoreDetail")
    @ResponseBody
    public ResponseMsg addOutStoreDetail(@RequestBody OutStoreDetail outStoreDetail){
        logger.info("OutStoreDetailController addOutStoreDetail outStoreDetail:"+outStoreDetail);
        ResponseMsg msg =outStoreDetailFeign.addOutStoreDetail(outStoreDetail);
        logger.debug("OutStoreDetailController addOutStoreDetail outStoreDetail:"+outStoreDetail);
        return null;
    }
}
